package com.ease.util {
   import com.ease.util.logging.LogManager;

   import mx.logging.ILogger;

   [SDK]
   /**
    * Diagnostic utility methods useful in development and identifying issues in
    * production code.
    *
    * <p>Typically, each of these could have different behaviors in debug and release builds.
    * Please reference the method documentation for specifics on the differences.</p>
    *
    * <p>SDK Version 1.0.0</p>
    */
   public class Diagnostics {
      private static var _logger:ILogger = LogManager.getLogger(Diagnostics);

      /**
       * Asserts if the given condition is true. If not, then throws
       * an <code>Error</code> using the given <code>message</code>.
       *
       * <p>Note: Asserts are triggered only in debug builds.</p>
       */
      public static function assert( condition:Boolean, message:String ):void {
         if (condition) {
            return;
         }

         var e:Error = new Error( "Assertion failed: " + message );

         // Log the error stack trace.
         _logger.error(e.getStackTrace());

         throw e;
      }
   }

}